﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MangoCannon.Framework.Socket;

namespace MangoCannon.Framework.Base
{
    public interface IBaseApp
    {
        /// <summary>
        /// 服务器启动时
        /// </summary>
        void luanch();
        /// <summary>
        /// 服务器关停
        /// </summary>
        /// <param name="status">0是正常退出服务，1是强制关闭，2是等待客户端断开后退出</param>
        void shutdown(int status);
        /// <summary>
        /// 启动监听
        /// </summary>
        void startListen();
        /// <summary>
        /// 停止监听
        /// </summary>
        void stopListen();
        /// <summary>
        /// 有客户进入服务器
        /// </summary>
        /// <param name="client"></param>
        /// <param name="isVirtual">是否虚拟连接产生的</param>
        void join(ClientHandle client,bool isVirtual);
        /// <summary>
        /// 有客户离开服务器
        /// </summary>
        /// <param name="client"></param>
        /// <param name="isVirtual">是否虚拟连接产生的</param>
        void leave(ClientHandle client,bool isVirtual);
        void message(ClientHandle client, ClientMessage clientMsg);
    }
}
